package com.zhkj.txg.module.mine.adapter

import android.widget.ImageView
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.zhkj.txg.R
import com.zhkj.txg.module.home.ui.WelfareActivity
import com.zhkj.txg.module.mine.entity.GuideListEntity
import com.zhkj.txg.utils.ImageUtils

class HelpAdapter : BaseQuickAdapter<GuideListEntity, BaseViewHolder>(R.layout.item_guide_list) {

    init {
        setOnItemClickListener { _, _, position ->
            val entity = data[position]
            WelfareActivity.guide(context, entity.id, entity.title)
        }
    }

    override fun convert(helper: BaseViewHolder, item: GuideListEntity) {
        val imageView = helper.setText(R.id.tvGuideName, item.title).setText(R.id.tvGuideDesc, item.desc)
            .getView<ImageView>(R.id.ivGuide)
        ImageUtils.loadRoundCornerImage(context, imageView, item.image)
    }
}